package com.psbc.springbootstudydemo1.utils;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class JsonData {
    private int code;
    private Object data;
    private String msg;
    public JsonData(Integer code,Object data){
        this.code = code;
        this.data = data;
    }
    public static JsonData buildSuccess(Object data){
        return new JsonData(0,data);
    }
    public static JsonData buildError(String msg){
        return new JsonData(-1,"",msg);
    }
    public static JsonData buildError(String msg,Integer code){
        return new JsonData(code,"",msg);
    }
}
